package com.surendra.firstproject.stutterreengineerin;

import java.awt.List;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;

public class Stutter {

	/**
	 * @param args
	
	 */
	public static void compareTo(String [] stringList) {
		int i=0;
		int j=0;
		for(i=j; i<stringList.length;i++) {
			System.out.print("\t"+stringList[i]);
			int compareValue= stringList[j].compareToIgnoreCase(stringList[i]);
			if(compareValue==0) {
				System.out.print(stringList[j]);
			printString( stringList[j]);
		}
		}
		j++;
	}
	
	public static void printString(String object) {
		// TODO Auto-generated method stub
		System.out.println("Print :"+object);
	}

	
	public static void main(String[] args)  {
		try {
	
	Scanner inFile= new Scanner(new FileReader("TestFile1.txt"));
	
	ArrayList<String> stringList= new ArrayList<String>();
	
	
	while(inFile.hasNext()) {
	stringList.add(inFile.next());
		
		
	}
	String[] strObj= new String[stringList.size()];
	Iterator<String> it =stringList.iterator();
	while(it.hasNext()) {
		for(int x=0; x<stringList.size(); x++) {
		strObj[x]=it.next();
		System.out.println(strObj[x]);
		}
	}
	
	inFile.close();
	compareTo(strObj);
		}catch(IOException e) {
			e.printStackTrace();
		} 
	
	
	
		
	}

}
